[Win32] Remove runtime change of process DPI awareness#3363
Conversation
SWT initialization modifies the process DPI awareness via the static initializer of the OS class. This has been implemented for DPI awareness on Windows Vista long time ago. Changing process DPI awareness programmatically is discouraged and should rather be done by the application's manifest. In addition, relevant executables into which SWT is embedded (JVM, Equinox launcher etc.) already have state-of-the-art settings for DPI awareness, which even activate higher levels of DPI awareness than what the call to setProcessDPIAware (conforming to "System" DPI awareness) does. In consequence, this call has no benefit but may rather interfere with DPI awareness settings already done via the manifest. This change thus removes the obsolete programmatic setting of process DPI awareness along with the now unused native method.
5848adc to
23d3655
Compare
Are there any known side-effects of this in the wild? |
No, I am not aware of any. From the API documentation, I would expect the method to "downgrade" the DPI awareness, but even though the method returns "true" (which means "success"), it does actually not change the DPI awareness (otherwise we would have already noticed at many places). The processes still run at PerMonitorV2, so it effectively seems to only upgrade if no DPI awareness is set. |
|
So it might be necessary to fix the launcher executable for all SWT based applications? |
In case you have a custom executable that was configured in a way that setting process DPI awareness from within the process to "System" had any effect, then: in theory, yes. So in summary, I am not sure how the removed code can have had any effect at all. If you have a concrete scenario where the code did anything reasonable (and maybe was even necessary), please let me know. |
SWT initialization modifies the process DPI awareness via the static initializer of the OS class. This has been implemented for DPI awareness on Windows Vista long time ago (c9bc8bf). Changing process DPI awareness programmatically is discouraged and should rather be done by the application's manifest: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware
In addition, relevant executables into which SWT is embedded (JVM, Equinox launcher etc.) already have state-of-the-art settings for DPI awareness, which even activate higher levels of DPI awareness than what the call to
setProcessDPIAware(conforming to "System" DPI awareness) does. In consequence, this call has no benefit but may rather interfere with DPI awareness settings already done via the manifest.This change thus removes the obsolete programmatic setting of process DPI awareness along with the now unused native method.